package com.ccs.onlinemusic.server;


import com.ccs.onlinemusic.mapper.MusicMapper;
import com.ccs.onlinemusic.model.Music;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MusicServer {

    @Autowired
    private MusicMapper musicMapper;

    //插入音乐
    public int insert(String title,String singer,String time,String url,int userid){
        return musicMapper.insert(title,singer,time,url,userid);
    }

    //根据id删除音乐
    public int deleteMusicById(int id){
        return musicMapper.deleteMusicById(id);
    }


    //根据id查询音乐
    public Music findMusicById(int id){
        return musicMapper.findMusicById(id);
    }

    public List<Music> findMusic(){
        return musicMapper.findMusic();
    }

    public List<Music> findMusicByMusicName(String musicName){
        return musicMapper.findMusicByMusicName(musicName);
    }



}
